{include file="header/index" /}

<div class="container bgwhite">
    <h2 class="mail-title">查看站内信</h2>
    <div class="lookLetter clearfix">
        <p class="letter-top col-xs-12">
            <!--<button class="letterReply" onclick="letters()">回复</button>-->
            <button class="letterReturn" onclick="letterdelete()">删除</button>
            <input value="{$data.id}" type="hidden" name="id" id="id" />
            <input value="{$redtype}" type="hidden" name="redtype" id="redtype" />
            <button class="letterReturn" onClick="location.href='index.html'">返回</button>
        </p>
        <p class=" col-xs-12 letter-title">
            短信息
        </p>
        <div class="col-xs-12 letter-center">
            <p class="col-xs-2 letter-center-title">发件人：</p>
            <p class="col-xs-4 letter-center-nr">{$data.message_id}</p>
            <p class="col-xs-2 letter-center-title">发送时间：</p>
            <p class="col-xs-4 letter-center-nr">{$data.send_time|date="Y年m月d日 H:i:s",###}</p>
        </div>
        <div class="col-xs-12 letter-bottom">
            <p class="col-xs-2 letter-center-title">内容：</p>
            <p class="col-xs-10 letter-center-nr ellipsis">{$data.content}</p>
        </div>
    </div>
</div>

<div class="write_letters_center hides">
    <form name="" enctype="multipart/form-data">
        <div class="letter-popup">
            <h2 class="letter-popup-title">写信<span onclick="letterHides()" class="fr"><img src="__IMG__/guanbi.png"></span></h2>
            <div class="letter-choice">
                <div>
                    <div class="clearfix letters-web">
                        <p class="fl letters-web-left">内容</p>
                        <p class="fl letters-web-right"><textarea></textarea></p>
                    </div>

                </div>
            </div>
            <p class="letters-btn">
                <button type="button" class="lettersSend-btn">发送</button>
                <button type="button" class="lettersCancel-btn" onclick="letterHides()">取消</button>
            </p>
        </div>
    </form>
</div>
<script>
    function letters() {
        $(".write_letters_center").show();
    }

    function letterHides() {
        $(".write_letters_center").hide();
    }

    function letterdelete(){
        var id = $("#id").val(); //获取
        //标识
        var redtype = $("#redtype").val();
        console.info(id);
        layer.msg('你确定删除么？', {
            time: 0 //不自动关闭
            ,btn: ['确定', '取消']
            ,yes: function(index){
                $.ajax({
                    url:"{:url('Letter/del')}",
                    data:{'id':id,'redtype':redtype},
                    type:"Post",
                    dataType:"json",
                    success:function(data){
                        layer.msg(data.msg);
                        if(data.code==1){
                            window.location.href="{:url('Letter/index')}";
                        }
                    },
                    error:function(data){
                        $.messager.alert('错误',data.msg);
                    }
                });
                layer.close(index);

            }
        });
    }
</script>
</body>
</html>
